package com.atguigu.testdemo;

import com.atguigu.life.BeanLife;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class TestLife {
    /**
     * 测试 : 配置对象的生命周期
     */
    @Test
    public void test1() {
//        ApplicationContext context=new ClassPathXmlApplicationContext("bean8.xml");
        ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("bean8.xml");
        BeanLife beanLife = context.getBean("BeanLife", BeanLife.class);
        System.out.println("第四步:获取对象:" + beanLife);
        //手动销毁
        context.close();
    }
}
